package C;

import java.util.Arrays;
import java.util.Scanner;

public class C75 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] nums = Arrays.stream(sc.nextLine().split(",")).mapToInt(Integer::parseInt).toArray();

        System.out.println(getResult(nums));
    }

    public static int getResult(int[] nums) {
        if (nums.length==1) return nums[0];
        if (nums.length==2) {
            int num1 = Integer.parseInt(String.valueOf(nums[0])+String.valueOf(nums[1]));
            int num2 = Integer.parseInt(String.valueOf(nums[1])+String.valueOf(nums[0]));
            return num1<num2?  num1 : num2;
        }

        Arrays.sort(nums);
        System.out.println(Arrays.toString(nums));

        int res = Integer.MAX_VALUE;
        int[] restNums = Arrays.copyOf(nums,3);

        for (int i = 0; i < restNums.length; i++) {
            for (int j = 0; j < restNums.length; j++) {
                if (j==i) continue;
                for (int k = 0; k < restNums.length; k++) {
                    if (k==i||k==j) continue;
                    res = Math.min(res,Integer.parseInt(restNums[i]+""+restNums[j]+""+restNums[k]));
                }
            }
        }

        return res;
    }
}
